<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="平视仪复杂动作判断" prop="psydz">
            <el-input v-model="form.psydz" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="仪表复杂动作判断" prop="ybdz">
            <el-input v-model="form.ybdz" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="自由练习">
            <el-input v-model="form.zylx" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="固定航线飞行">
            <el-input v-model="form.gdhxfx" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="模拟飞行着陆">
            <el-input v-model="form.mnfxzl" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="速度表闪现">
            <el-input v-model="form.sdbsx" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="高度表闪现">
            <el-input v-model="form.gdbsx" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="平视仪闪现">
            <el-input v-model="form.psysx" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="地平仪闪现">
            <el-input v-model="form.dpysx" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="罗盘闪现">
            <el-input v-model="form.lpsx" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="坚信平视仪_航向误差">
            <el-input v-model="form.jspsyHxwc" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="坚信平视仪_高度误差">
            <el-input v-model="form.jspsyGdwc" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="坚信平视仪_附加成绩">
            <el-input v-model="form.jspsyFjcj" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="坚信平视仪_保持时间">
            <el-input v-model="form.jspsyBcsj" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="坚信仪表_航向误差">
            <el-input v-model="form.jsybHxwc" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="坚信仪表_高度误差">
            <el-input v-model="form.jsybGdwc" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="坚信仪表_附加成绩">
            <el-input v-model="form.jsybFjcj" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="坚信仪表_保持时间">
            <el-input v-model="form.jsybBcsj" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="评定结果">
            <el-input v-model="form.result" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="记录人">
            <el-input v-model="form.createBy" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="记录日期">
            <el-input v-model="form.date" style="width: 370px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <el-table-column type="selection" width="55" />
        <el-table-column prop="psydz" label="平视仪复杂动作判断" />
        <el-table-column prop="ybdz" label="仪表复杂动作判断" />
        <el-table-column prop="zylx" label="自由练习" />
        <el-table-column prop="gdhxfx" label="固定航线飞行" />
        <el-table-column prop="mnfxzl" label="模拟飞行着陆" />
        <el-table-column prop="sdbsx" label="速度表闪现" />
        <el-table-column prop="gdbsx" label="高度表闪现" />
        <el-table-column prop="psysx" label="平视仪闪现" />
        <el-table-column prop="dpysx" label="地平仪闪现" />
        <el-table-column prop="lpsx" label="罗盘闪现" />
        <el-table-column prop="jspsyHxwc" label="坚信平视仪_航向误差" />
        <el-table-column prop="jspsyGdwc" label="坚信平视仪_高度误差" />
        <el-table-column prop="jspsyFjcj" label="坚信平视仪_附加成绩" />
        <el-table-column prop="jspsyBcsj" label="坚信平视仪_保持时间" />
        <el-table-column prop="jsybHxwc" label="坚信仪表_航向误差" />
        <el-table-column prop="jsybGdwc" label="坚信仪表_高度误差" />
        <el-table-column prop="jsybFjcj" label="坚信仪表_附加成绩" />
        <el-table-column prop="jsybBcsj" label="坚信仪表_保持时间" />
        <el-table-column prop="result" label="评定结果" />
        <el-table-column prop="createBy" label="记录人" />
        <el-table-column prop="date" label="记录日期" />
        <el-table-column v-if="checkPer(['admin','trainFxybdx:edit','trainFxybdx:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column>
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudTrainFxybdx from '@/api/trainFxybdx'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { id: null, trainId: null, psydz: null, ybdz: null, zylx: null, gdhxfx: null, mnfxzl: null, sdbsx: null, gdbsx: null, psysx: null, dpysx: null, lpsx: null, jspsyHxwc: null, jspsyGdwc: null, jspsyFjcj: null, jspsyBcsj: null, jsybHxwc: null, jsybGdwc: null, jsybFjcj: null, jsybBcsj: null, result: null, createBy: null, createTime: null, date: null, updateTime: null, trainItemId: null }
export default {
  name: 'TrainFxybdx',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '飞行仪表定向', url: 'api/trainFxybdx', idField: 'id', sort: 'id,desc', crudMethod: { ...crudTrainFxybdx }})
  },
  data() {
    return {
      permission: {
        add: ['admin', 'trainFxybdx:add'],
        edit: ['admin', 'trainFxybdx:edit'],
        del: ['admin', 'trainFxybdx:del']
      },
      rules: {
        psydz: [
          { required: true, message: '平视仪复杂动作判断不能为空', trigger: 'blur' }
        ],
        ybdz: [
          { required: true, message: '仪表复杂动作判断不能为空', trigger: 'blur' }
        ]
      }    }
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
